<?php

/**
 * LigneTicketCaisse form base class.
 *
 * @method LigneTicketCaisse getObject() Returns the current form's model object
 *
 * @package    SdCommerce
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseLigneTicketCaisseForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                  => new sfWidgetFormInputHidden(),
      'id_ticket_caisse'    => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('TicketCaisse'), 'add_empty' => false)),
      'id_stock_article'    => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('StockArticle'), 'add_empty' => true)),
      'id_foire'            => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Foire'), 'add_empty' => true)),
      'montant_ttc'         => new sfWidgetFormInputText(),
      'quantite'            => new sfWidgetFormInputText(),
      'designation_article' => new sfWidgetFormInputText(),
      'tva_article'         => new sfWidgetFormInputText(),
      'prix_unitaire'       => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'                  => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'id_ticket_caisse'    => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('TicketCaisse'))),
      'id_stock_article'    => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('StockArticle'), 'required' => false)),
      'id_foire'            => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Foire'), 'required' => false)),
      'montant_ttc'         => new sfValidatorNumber(array('required' => false)),
      'quantite'            => new sfValidatorInteger(),
      'designation_article' => new sfValidatorString(array('max_length' => 225, 'required' => false)),
      'tva_article'         => new sfValidatorString(array('max_length' => 225, 'required' => false)),
      'prix_unitaire'       => new sfValidatorNumber(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('ligne_ticket_caisse[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'LigneTicketCaisse';
  }

}
